package com.ai.service.made.impl;

import com.ai.common.CommonResponse;
import com.ai.entity.exam.ExamRecordAnswerInfoPO;
import com.ai.mapper.made.ExamRecordAnswerInfoMapper;
import com.ai.service.made.ExamRecordAnswerInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @Author：xiaosheng
 * @Date：2024-07-02 15:36
 */
@Service
public class ExamRecordAnswerInfoServiceImpl extends ServiceImpl<ExamRecordAnswerInfoMapper, ExamRecordAnswerInfoPO> implements ExamRecordAnswerInfoService {

    @Resource
    ExamRecordAnswerInfoMapper examRecordAnswerInfoMapper;

    @Override
    public CommonResponse insert(ExamRecordAnswerInfoPO examRecordAnswerInfoPO) {
        return CommonResponse.ok(examRecordAnswerInfoMapper.insert(examRecordAnswerInfoPO));
    }

    @Override
    public List<ExamRecordAnswerInfoPO> selectByExamRecordInfoId(Integer id) {
        QueryWrapper<ExamRecordAnswerInfoPO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("exam_record_info_id", id);
        List<ExamRecordAnswerInfoPO> examRecordAnswerInfoPOList = examRecordAnswerInfoMapper.selectList(queryWrapper);
        return examRecordAnswerInfoPOList;
    }
}
